﻿
@using System.Data;
@using Shop.Entity;
@using Webdiyer.WebControls.Mvc;
@{
    Layout = null;
}
@model  PagedList<DataRow>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>列表</title>
    <link href="~/Content/admin/css/bootstrap.min.css" rel="stylesheet" />
    <link href="~/Content/kindeditor/themes/default/default.css" rel="stylesheet" />
    <script src="/Scripts/jquery-1.10.2.min.js"></script>
    <script src="~/Content/admin/js/bootstrap.min.js"></script>
</head>
<body>
    <div class="container-fluid">
        <ol class="breadcrumb">
            <li><a href="/set/admin/center">首页></a></li>
            <li><a href="#">线上商城></a></li>
            <li class="active">商品品牌</li>
        </ol>

        <div class="portlet-body">
            <div class="navbar-form navbar-left" role="search" style="padding:0px;">
                <a class="btn btn-primary btn-sm " onclick="Add();"><span class="glyphicon glyphicon-plus" aria-hidden="true"></span>新增</a>
            </div>
            <form class="navbar-form navbar-left" id="formSearch" role="form" action="/GoodsManage/Brand/List">
                <div class="form-group">
                    <input type="hidden" name="PageSize" value="15" />
                    <input type="text" class="form-control input-sm" id="SearchTitle" name="title" placeholder="请输入品牌名称" />
                    @Html.DropDownList("GoodsCategory", (SelectList)ViewData["CateGory"], "-商品类别-", new { @class = "form-control input-sm" })
                </div>
                <button type="submit" class="btn btn-primary btn-sm ">
                    <span class="glyphicon glyphicon-zoom-in" aria-hidden="true"></span>&nbsp;搜索
                </button>
            </form>
            <div id="divTable">
                @Html.Partial("_Table", Model)

                @{Html.RegisterMvcPagerScriptResource();}
            </div>
           
            <div id="divAdd">
                @Html.Partial("_Add", new TBrand())
            </div>
        </div>
    </div>
    <script src="~/Content/kindeditor/kindeditor-all-min.js"></script>
    <script src="/Content/Validform_v5.3.2/Validform_v5.3.2_min.js"></script>
    <script src="~/Content/layer/layer.js"></script>
    <script type="text/javascript">
        KindEditor.ready(function (K)
        {
            var editor = K.editor({
                uploadJson: '/Content/kindeditor/asp.net/upload_json.ashx',
                fileManagerJson: '/Content/kindeditor/asp.net/file_manager_json.ashx',
                allowFileManager: true
            });
            K('#image1').click(function ()
            {
                editor.loadPlugin('image', function ()
                {
                    editor.plugin.imageDialog({
                        imageUrl: K('#url1').val(),
                        urlType: "relative",
                        showRemote: false,
                        clickFn: function (url, title, width, height, border, align)
                        {
                            K('#url1').val(url);
                            editor.hideDialog();
                        }
                    });
                });
            });
        });

        function Add()
        {

            $("#Guid").val("");
            $("#Title").val("");
            $("#Sort").val("");
            $("#Remark").val("");
            $("#url1").val("");
            $("#Url").val("");
            $("#headerTitle").text("新增品牌");
            $(this).removeData('modal');
            $("#Add").modal('show');
            $("#Title").focus();
        }
        function Edit()
        {
            $("#headerTitle").text("编辑品牌-" + arguments[2]);
            $(this).removeData('modal');
            $("#Add").modal('show');
            $("#Title").focus();
            $("#Guid").val(arguments[0]);
            $("#OperatorGuid").val(arguments[1]);
            $("#Title").val(arguments[2]);
            $("#url1").val(arguments[3]);
            //$("#Category").val(arguments[4]);
            $("#Url").val(arguments[4]);
            $("#Sort").val(arguments[5]);
            $("#Remark").val(arguments[6]);
        }
        function Delete(obj, title)
        {
            parent.layer.confirm('确定要删除【' + title + '】吗?', {
                title: "提示", icon: 3,
                btn: ['确定', '取消'] //按钮
            }, function ()
            {
                $.post("/GoodsManage/Brand/delete", { guid: obj }, function (data)
                {
                    parent.layer.closeAll('dialog'); //关闭信息框
                    if (data.succ)
                    {
                        parent.layer.msg('删除成功!', { icon: 1 });
                        $("#formSearch").submit();

                        //  window.location.reload();
                    } else
                    {
                        parent.layer.alert(data.msg, { title: "提示", icon: 5, time: 5000 });
                    }

                })
            }, function () { });
        }

        function PageSizeChange()
        {
            $("input[name='PageSize']").val($("#PageSize").val());
            window.location.href = '/GoodsManage/Brand/List?PageSize=' + $("input[name='PageSize']").val();
        }
        function MouseShowImage(obj)
        {
            parent.layer.open({
                type: 5,
                title: false,
                closeBtn: 0,
                shade: 0,
                content: "<img  src='" + $(obj).attr("src") + "'/>"
            });
            $(obj).mouseout(function ()
            {
                parent.layer.closeAll();
            });
        }
    </script>
</body>
</html>
